<template>
  <el-upload
      class="upload-demo"
      v-model:file-list="fileList"
      :action="'/api/file/upload/'+props.url"
      :on-success="upSuccess"
      :limit="1"
  >
    <el-button type="primary">上传</el-button>
  </el-upload>
</template>

<script setup lang="ts">
import { ref, defineEmits,defineProps } from "vue";
import type { UploadUserFile } from 'element-plus'

const fileList = ref<UploadUserFile[]>([])
let props=defineProps({
  url:{
    type:String,
    default:""
  },
  limit:{
    type:Number,
    default:1
  }
})
const emits = defineEmits(["filePath"]);

let upSuccess=(response)=>{
  emits("filePath",response.data)
}

</script>

<style scoped>

</style>
